package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.Sutrax;

/**
 * QSutrax is a ORMLite query type for Sutrax
 * @see Sutrax
 */
public class QSutrax extends QEntityBase<Sutrax> {

    public static final QSutrax $ = new QSutrax("SUTRAX");

    public final Column name = field("name").columnName("NAME").varchar(32).notNull().build();

    public final Column seqOrder = field("seqOrder").columnName("SEQ_ORDER").integer().notNull().build();

    public final Column price = field("price").columnName("PRICE").decimal(12, 3).notNull().build();

    public final Column templateId = field("templateId").columnName("TEMPLATE_ID").varchar(22).notNull().build();

    public class Indexs {

        public final Index primaryKey92 = index("PRIMARY_KEY_92").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QSutrax(String tableName) {
        super(Sutrax.class, tableName);
    }

    @Override
    public Sutrax newInstance() {
        return new Sutrax();
    }

    @Override
    public Object getFieldValue(Sutrax instance, String fieldName) {
        switch (fieldName) {
            case "name":
                return instance.getName();
            case "seqOrder":
                return instance.getSeqOrder();
            case "price":
                return instance.getPrice();
            case "templateId":
                return instance.getTemplateId();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(Sutrax instance, String fieldName, Object value) {
        switch (fieldName) {
            case "name":
                instance.setName((java.lang.String) value);
                break;
            case "seqOrder":
                instance.setSeqOrder((java.lang.Integer) value);
                break;
            case "price":
                instance.setPrice((java.math.BigDecimal) value);
                break;
            case "templateId":
                instance.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

